package com.flexycore.iphone.view;

import com.flexycore.iphone.uikit.UIScreen;
import com.flexycore.iphone.uikit.UIViewController;
import com.flexycore.iphone.uikit.UIWebView;
import com.flexycore.iphone.uikit.UIWebViewDelegate;

public class WebViewController extends UIViewController {

	private String url;

	private UIWebView webView;
	private UIWebViewDelegate delegate;

	public WebViewController(String url) {
		init();
		this.url = url;
		setTitle("WebView Sample");
	}

	public void loadView() {
		// Construct web view
		webView = new UIWebView();
		webView.initWithFrame(UIScreen.mainScreen().applicationFrame());

		// Set web view as controller's view
		setView(webView);

		// Set delegate
		delegate = new WebViewDelegate();
		webView.setDelegate(delegate);

		// Load url into web view
		webView.loadRequest(url);
	}
}
